package cn.lh.basic.service.impl;

import cn.lh.basic.service.IBaiduAiAuditService;
import cn.lh.basic.util.BaiduAuditUtils;
import org.springframework.stereotype.Service;

@Service
public class BaiduAiAuditServiceImpl implements IBaiduAiAuditService {
    private static final String RESOURCE_PREFIX = "http://123.207.27.208";

    public boolean textAudit(String text) {
        return BaiduAuditUtils.textCensor(text);
    }

    public boolean imgAudit(String... imageUrls) {
        for (String imageUrl : imageUrls) {
            Boolean result = BaiduAuditUtils.imgCensor(RESOURCE_PREFIX + imageUrl);
            if (result.equals(false)) {
                return false;
            }
        }
        return true;
    }
}
